
import React from 'react'
import { Button, List } from 'antd'

export default ({ list, read, create }) => {

    return (
        <div className="menu">
            <Button type="primary" style={{width: '100%',marginBottom:'10px'}} onClick={create}>创作一下！</Button>
            <List 
            style={{
                height: 'calc(100vh - 110px)',
                overflow: 'auto'
            }}
            bordered
            dataSource={list}
            renderItem={t => <List.Item key={t.id} onClick={() => read(t)}>
                <div className="menu-title">
                    <span>{t.title||'未命名'}</span>
                    <span className="menu-title-date">{t.date}</span>
                </div>
            </List.Item>}
            />
        </div>
    )
}